package cn.bearspark.article.provider.dao.key;

import cn.bearspark.framework.redis.starter.buffer.hash.un.RedisHashBufferKeyBuilder;
import cn.bearspark.framework.redis.starter.key.RedisKeyBuilder;
import org.springframework.stereotype.Component;

/**
 * 专栏分类的缓存器的键的构造器
 *
 * @author f
 */
@Component
public class CategoryBufferKeyBuilder extends RedisKeyBuilder implements RedisHashBufferKeyBuilder {

    /**
     * 专栏分类的信息的缓存的键的前缀
     */
    private static final String CATEGORY_INFO = "categoryInfo";

    /**
     * 用户自己创建的专栏分类的 id 集合的缓存的键的前缀
     */
    private static final String CATEGORY_ID_LIST = "categoryIdList";

    @Override
    public String buildHashBufferKey(long categoryId) {
        return super.getPrefix() + CATEGORY_INFO + super.getSplitItem() + categoryId;
    }

    public String buildIdListKey(long listedUserId) {
        return super.getPrefix() + CATEGORY_ID_LIST + super.getSplitItem() + listedUserId;
    }
}
